package cl.rizepe.playntest.core.menu;

import java.util.ArrayList;

import playn.core.Layer;
import pythagoras.f.Point;


public class Menu {
	ArrayList<Layer> buttons;
	MenuOrigin origin;
	Point buttonSize;
	MenuDirection direction;
	
	public Menu(MenuOrigin origin, MenuDirection direction, Point buttonSize ){
		buttons= new ArrayList<Layer>();
		this.origin=origin;
		this.direction=direction;
		this.buttonSize=buttonSize;
	}
	
	
	
	public ArrayList<Layer> getButtons() {
		return buttons;
	}



	public void setButtons(ArrayList<Layer> buttons) {
		this.buttons = buttons;
	}



	public MenuOrigin getOrigin() {
		return origin;
	}



	public void setOrigin(MenuOrigin origin) {
		this.origin = origin;
	}



	public Point getButtonSize() {
		return buttonSize;
	}



	public void setButtonSize(Point buttonSize) {
		this.buttonSize = buttonSize;
	}



	public MenuDirection getDirection() {
		return direction;
	}



	public void setDirection(MenuDirection direction) {
		this.direction = direction;
	}



	public void draw(){
		Point menuOrigin=origin.getMenuOrigin();
	//	float x= origin.getMenuOrigin().x();
//	/	float y=origin.getMenuOrigin().y();
		for (int index=0;index<buttons.size();index++){
			Point p =direction.pointLocation(index); 
		//	x+=p.x();
		//	y+=p.y();
			//buttons.get(index).getImageLayer().setTranslation(x, y);
			buttons.get(index).setTranslation(menuOrigin.x()+p.x(), menuOrigin.y()+p.y());
	//		buttons.get(index).getImageLayer().setAlpha((float) (0.1+(float)index/(float)buttons.size()));
			buttons.get(index).setVisible(true);
		}
	}
	
	public void erase(){
		for (Layer layerState : buttons){
			layerState.setVisible(false);
		}
	}
	
	public void addButton(Layer ls){
		buttons.add(ls);
	}
	
	public void removeButton(int index){
		if (buttons.size()<index)
			buttons.remove(index);
	}
	
	
	
/*	LayerStateCollection
	buton_size
	-location
	-direction
	addButton(button)
	removeButton(index)
	nextLocation
*/
	
}
